English Computing Dictionary
◊ HUNGARIAN NOTATION
Hungarian Notation
A linguistic convention requiring one
or more letters to be added to the front of {variable} names
to denote {scope} and/or {type}.
Hungarian Notation is mainly confined to {Microsoft Windows}
programming environments, such as Microsoft {C}, {C::} and
{Visual Basic}.
It was originally devised by {Charles Simonyi}, a Hungarian,
who was a senior programmer at {Microsoft} for many years. He
disliked the way that names in C programs could stand for any
kind of variable. This was for ever leading to mistakes, as
programmers tried to manipulate variables in ways that their
type prohibited, which they would never had done if they
remembered what sort they were.
According to legend, fellow programmers at Microsoft looked at
the convoluted, vowel-less variable names produced by his
scheme and, like everyone else who has come into contact with
them since, said something like "This might as well be in
Greek - or even Hungarian!". They almost certainly had in mind
as well another kind of {mathematical} system called "Polish
notation" (a variant form called {reverse Polish notation} is
commonly used in {calculators}, which leads to expressions
without brackets or punctuation which are easier to enter).
They put the two together and made up the name "Hungarian
notation".
Hungarian Notation is not really necessary when using a modern
{strongly-typed language} as the {compiler} warns the
programmer if a variable of one type is used as if it were
another type. It is less useful in {object-oriented
programming} languages such as {C::}, where many variables are
going to be instances of {classes} [Why?].
In addition, variable names are essentially only {comments},
and thus are just as susceptible to becoming out of date and
incorrect as any other comment. For example, if a {signed}
{short} {int} becomes an unsigned {long} int, the variable
name, and every use of it throughout the program, should be
changed to reflect its new type.
If used appropriately however, it does enforce a certain
consistency, especially when scoping is taken into account
as well as type (for example g_ for global variables,
m_ for members, c_ for static members, l_ for local, etc.).
{Simonyi's original monograph
(http://www.strangecreations.com/library/c/naming.txt)}.
{Microsoft VB Naming Conventions
(http://support.microsoft.com/support/kb/articles/Q110/2/64.asp)}.
(1999-06-03)